<template>
  <section>
    <template>
      <el-divider>答案与分值222</el-divider>
      <el-form-item label="得分分值11">
        <el-switch v-model="value.value" />
      </el-form-item>
    </template>
    <template v-if="value.value===true">
      <el-form-item label="计分方式">
        <el-select v-model="value.method" placeholder="请选择" :style="{ width: '100%' }" clearable>
          <el-option label="答对题目才有分值" value="oneanswer" />
          <el-option label="每个选项都有分值" value="everyscore" />
        </el-select>
      </el-form-item>
      <el-form-item v-if="value.method==='oneanswer'" label="答案">
        <el-select v-model="value.oneanswer.answer" placeholder="请选择" :style="{ width: '100%' }" clearable>
          <el-option v-for="(item, index) in list" :key="index" :label="item.value" :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item v-if="value.method==='oneanswer'" label="得分">
        <el-input-number v-model="value.oneanswer.score"></el-input-number>
      </el-form-item>
      <el-form-item v-if="value.method==='everyscore'" label="各选项分值">
        <div v-for="(item, index) in list" :key="index" class="select-item">
          <span style="width:100px">{{item.value}}</span>
          <el-input-number v-model="item.score"></el-input-number>
        </div>
      </el-form-item>
      <el-form-item label="">
        <span slot="label">答案解析<br>可不填</span>
        <textarea style="width:100%" Rows="3" v-model="value.analysis"></textarea>
      </el-form-item>
      <el-divider />
    </template>
    <el-form-item v-if="(value.value===true || value.method==='oneanswer' || value.method==='everyscore')"
      label=" 是否显示分4数">
      <el-switch v-model="value.showscore" />
    </el-form-item>
  </section>
</template>

<script>
  export default {
    props: {
      value: {
        type: Object,
        default: null
      },
      list: {
        type: Array,
        default: null
      },
    },
    data() {
      return {
        sp: {},
        sr: {},
        param: {}
      }
    },
    created(options) {
      let that = this;
      that.xinit();
    },
    methods: {
      xinit() {
        let that = this;
      },
    }
  }
</script>

<style>

</style>
